﻿<local:BasePage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:PanoramaItems="clr-namespace:BogheApp.PanoramaItems"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    x:Class="BogheApp.MainPage"
    mc:Ignorable="d"
    xmlns:local="clr-namespace:BogheApp"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">


    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush ImageSource="/BogheApp;component/Assets/PanoramaBackground.png"/>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.Resources>
            <DataTemplate x:Key="PanoramaItemTemplate">
                <Grid>
                    <ContentPresenter>
                        <TextBlock Foreground="White" Text="{Binding}" FontSize="35" />
                    </ContentPresenter>
                </Grid>
            </DataTemplate>
            <Style x:Key="StyleButtonKeyPad" TargetType="Button">
                <Setter Property="Opacity" Value="0.85" />
                <Setter Property="BorderThickness" Value="0" />
                <Setter Property="Background" Value="SkyBlue"/>
                <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
                <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
                <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
                <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
                <Setter Property="Padding" Value="0" />
                <Setter Property="Margin" Value="0" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <Grid Background="Transparent">
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="Normal"/>
                                        <VisualState x:Name="MouseOver"/>
                                        <VisualState x:Name="Pressed">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="SkyBlue"/>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Disabled">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="0">
                                    <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                </Border>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>

        <TextBlock Text="{Binding ConnectionStateText}" Foreground="White" />
        <phone:Panorama x:Name="panoramaMain" Title="Boghe" SelectionChanged="panoramaMain_SelectionChanged" Grid.Row="1">

            <!-- DIAL -->
            <phone:PanoramaItem x:Name="panoramaItemDial" Header="Dial" HeaderTemplate="{StaticResource PanoramaItemTemplate}">
                <Grid Grid.Row="6" Grid.Column="3" Margin="0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="90" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <ScrollViewer VerticalScrollBarVisibility="Auto" Grid.ColumnSpan="3" Margin="0,0,70,0">
                        <TextBlock x:Name="textBlockNumber" Text="" TextWrapping="Wrap" FontSize="60" Margin="0,0,0,10" />
                    </ScrollViewer>
                    <Button x:Name="buttonKeyPadDel" Style="{StaticResource StyleButtonKeyPad}" Grid.Column="2" BorderThickness="0" Opacity="1" Background="{StaticResource TransparentBrush}" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold" Width="64" Height="64" HorizontalAlignment="Right" VerticalAlignment="Center">
                        <Image x:Name="imageKeyPadDel" Source="Assets/back_64.png"/>
                    </Button>

                            <!-- Row-1: 1, 2, 3 -->
                    <Button x:Name="buttonKeyPad1" Style="{StaticResource StyleButtonKeyPad}" Margin="0,0,4,4" Grid.Row="1" UseLayoutRounding="True" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50">
								<Run Text="1"/>
                            </TextBlock>
                            <TextBlock Margin="10,0,0,0" Foreground="Gray" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25"/>
                        </StackPanel>
                    </Button>
                    <Button x:Name="buttonKeyPad2" Style="{StaticResource StyleButtonKeyPad}" Margin="0,0,4,4" Grid.Row="1" Grid.Column="1" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50">
								<Run Text="2"/>
                            </TextBlock>
                            <TextBlock Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25">
								<Run Text="ABC"/>
                            </TextBlock>
                        </StackPanel>
                    </Button>
                    <Button x:Name="buttonKeyPad3" Style="{StaticResource StyleButtonKeyPad}" Margin="0,0,0,4" Grid.Row="1" Grid.Column="2" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50">
								<Run Text="3"/>
                            </TextBlock>
                            <TextBlock Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25">
								<Run Text="DEF"/>
                            </TextBlock>
                        </StackPanel>
                    </Button>
                    <!-- Row-2: 4, 5, 6 -->
                    <Button x:Name="buttonKeyPad4" Style="{StaticResource StyleButtonKeyPad}" Margin="0,0,4,4" Grid.Row="2" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50">
								<Run Text="4"/>
                            </TextBlock>
                            <TextBlock Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25">
								<Run Text="GHI"/>
                            </TextBlock>
                        </StackPanel>
                    </Button>
                    <Button x:Name="buttonKeyPad5" Style="{StaticResource StyleButtonKeyPad}" Margin="0,0,4,4" Grid.Row="2" Grid.Column="1" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50">
								<Run Text="5"/>
                            </TextBlock>
                            <TextBlock Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25">
								<Run Text="JKL"/>
                            </TextBlock>
                        </StackPanel>
                    </Button>
                    <Button x:Name="buttonKeyPad6" Style="{StaticResource StyleButtonKeyPad}" Margin="0,0,0,4" Grid.Row="2" Grid.Column="2" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50">
								<Run Text="6"/>
                            </TextBlock>
                            <TextBlock Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25">
								<Run Text="MNO"/>
                            </TextBlock>
                        </StackPanel>
                    </Button>
                    <!-- Row-3: 7, 8, 9 -->
                    <Button x:Name="buttonKeyPad7" Style="{StaticResource StyleButtonKeyPad}" Margin="0,0,4,4" Grid.Row="3" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50">
								<Run Text="7"/>
                            </TextBlock>
                            <TextBlock Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25">
								<Run Text="PQRS"/>
                            </TextBlock>
                        </StackPanel>
                    </Button>
                    <Button x:Name="buttonKeyPad8" Style="{StaticResource StyleButtonKeyPad}" Margin="0,0,4,4" Grid.Row="3" Grid.Column="1" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50">
								<Run Text="8"/>
                            </TextBlock>
                            <TextBlock Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25">
								<Run Text="TUV"/>
                            </TextBlock>
                        </StackPanel>
                    </Button>
                    <Button x:Name="buttonKeyPad9" Style="{StaticResource StyleButtonKeyPad}" Margin="0,0,0,4" Grid.Row="3" Grid.Column="2" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50">
								<Run Text="9"/>
                            </TextBlock>
                            <TextBlock Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25">
								<Run Text="WXYZ"/>
                            </TextBlock>
                        </StackPanel>
                    </Button>
                    <!-- Row-4: *, 0, # -->
                    <Button x:Name="buttonKeyPadStar" Style="{StaticResource StyleButtonKeyPad}" Margin="0,0,4,0" Grid.Row="4" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50">
								<Run Text="*"/>
                            </TextBlock>
                            <TextBlock Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25"/>
                        </StackPanel>
                    </Button>
                    <Button x:Name="buttonKeyPad0" Style="{StaticResource StyleButtonKeyPad}" Margin="0,0,4,0" Grid.Row="4" Grid.Column="1" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock x:Name="textBlockKeyPad0" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50" Hold="buttonKeyPad_Hold">
								<Run Text="0"/>
                            </TextBlock>
                            <TextBlock x:Name="textBlockKeyPad0Plus" Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25" Hold="buttonKeyPad_Hold">
								<Run Text="+"/>
                            </TextBlock>
                        </StackPanel>
                    </Button>
                    <Button x:Name="buttonKeyPadSharp" Style="{StaticResource StyleButtonKeyPad}" Grid.Row="4" Grid.Column="2" Click="buttonKeyPad_Click" Hold="buttonKeyPad_Hold">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50">
								<Run Text="#"/>
                            </TextBlock>
                            <TextBlock Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" MinWidth="25"/>
                        </StackPanel>
                    </Button>
                    <!-- Row-5: Call buttons -->
                    <StackPanel Orientation="Horizontal" Grid.Row="5" Grid.ColumnSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Button x:Name="buttonCallAudio" IsEnabled="{Binding IsConnected}" Content="audio" Width="200" Click="buttonCall_Click" />
                        <Button x:Name="buttonCallVideo" IsEnabled="{Binding IsConnected}" Content="video" Width="200" Click="buttonCall_Click" />
                    </StackPanel>
                </Grid>
            </phone:PanoramaItem>

            <!-- HISTORY -->
            <!--phone:PanoramaItem x:Name="panoramaItemHistory" Header="History" HeaderTemplate="{StaticResource PanoramaItemTemplate}">
            </phone:PanoramaItem-->
            
            <!-- SETTINGS -->
            <phone:PanoramaItem x:Name="panoramaItemSettings">
                <phone:PanoramaItem.Header>
                    <Button x:Name="buttonSaveSettings" IsEnabled="False" Content="save" />
                </phone:PanoramaItem.Header>
                <phone:Pivot Title="{x:Null}">
                    <phone:PivotItem CacheMode="{x:Null}" Header="Credentials">
                        <ListBox>
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">
                                    <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
                                </Style>
                            </ListBox.ItemContainerStyle>

                            <StackPanel>
                                <TextBlock Text="Display Name"/>
                                <TextBox x:Name="textBoxDisplayName" TextChanged="textBoxSettings_TextChanged"/>
                            </StackPanel>
                            <StackPanel>
                                <TextBlock Text="Private Identity"/>
                                <TextBox x:Name="textBoxPrivateIdentity" TextChanged="textBoxSettings_TextChanged"/>
                            </StackPanel>
                            <StackPanel>
                                <TextBlock Text="Public Identity"/>
                                <TextBox x:Name="textBoxPublicIdentity" TextChanged="textBoxSettings_TextChanged"/>
                            </StackPanel>
                            <StackPanel>
                                <TextBlock Text="Password"/>
                                <PasswordBox  x:Name="passwordBoxPassword" PasswordChanged="passwordBoxPassword_PasswordChanged" />
                            </StackPanel>
                            <StackPanel>
                                <TextBlock Text="Realm"/>
                                <TextBox x:Name="textBoxRealm" TextChanged="textBoxSettings_TextChanged"/>
                            </StackPanel>
                        </ListBox>
                    </phone:PivotItem>
                    <phone:PivotItem CacheMode="{x:Null}" Header="Network">
                        <ListBox>
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">
                                    <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
                                </Style>
                            </ListBox.ItemContainerStyle>
                            <StackPanel>
                                <TextBlock Text="Proxy Host"/>
                                <TextBox x:Name="textBoxProxyHost" TextChanged="textBoxSettings_TextChanged"/>
                            </StackPanel>
                            <StackPanel>
                                <TextBlock Text="Proxy Port"/>
                                <TextBox x:Name="textBoxProxyPort" TextChanged="textBoxSettings_TextChanged" InputScope="Number"/>
                            </StackPanel>
                            <StackPanel>
                                <TextBlock Text="Transport"/>
                                <ListBox Margin="20,0,0,0">
                                    <RadioButton x:Name="radioButtonTransportUDP" Click="radioButtonTransport_Click">UDP</RadioButton>
                                    <RadioButton x:Name="radioButtonTransportTCP" Click="radioButtonTransport_Click">TCP</RadioButton>
                                </ListBox>
                            </StackPanel>

                        </ListBox>
                    </phone:PivotItem>
                </phone:Pivot>

            </phone:PanoramaItem>
        </phone:Panorama>

        <!--Uncomment to see an alignment grid to help ensure your controls are
            aligned on common boundaries.  The image has a top margin of -32px to
            account for the System Tray. Set this to 0 (or remove the margin altogether)
            if the System Tray is hidden.

            Before shipping remove this XAML and the image itself.-->
        <!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />-->

    </Grid>
</local:BasePage>